package com.tomorrowgamingkids.helloworld;

import android.app.Activity;
import android.opengl.GLSurfaceView;
import android.os.Bundle;

public class MainActivity extends Activity { //implements OnTouchListener 
	public final static String EXTRA_MESSAGE = "com.example.myapp.MESSAGE";

	private GLSurfaceView openglView;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //ViewGroup mainView = (ViewGroup) findViewById("helloworld");
        //this.getc
        
        openglView = new OpenGLView(this);
         
        setContentView(openglView);
        /*
        setContentView(R.layout.activity_main);
        Window mainWindow = getWindow();
        View mainView = mainWindow.peekDecorView();
        if(mainView != null)
        	mainView.setOnTouchListener(this);
        */
        //View mainView = (View) findViewById(R.layout.activity_main);
        
        //setContentView(mainView);
    }
    
    /*
    
    public boolean onTouch(View view, MotionEvent event) {
    	super.onTouchEvent(event);
    	
    	String names[] = { "DOWN" , "UP" , "MOVE" , "CANCEL" , "OUTSIDE" ,
    			"POINTER_DOWN" , "POINTER_UP" , "7?" , "8?" , "9?" };
		StringBuilder sb = new StringBuilder();
		int action = event.getAction();
		int actionCode = action & MotionEvent.ACTION_MASK;
		sb.append("event ACTION_" ).append(names[actionCode]);
		
		if (actionCode == MotionEvent.ACTION_POINTER_DOWN
				|| actionCode == MotionEvent.ACTION_POINTER_UP) {
			sb.append("(pid " ).append(action >> MotionEvent.ACTION_POINTER_ID_SHIFT);
			sb.append(")" );
		}
		
		sb.append("[" );
		for (int i = 0; i < event.getPointerCount(); i++) {
			sb.append("#" ).append(i);
			sb.append("(pid " ).append(event.getPointerId(i));
			sb.append(")=" ).append((int) event.getX(i));
			sb.append("," ).append((int) event.getY(i));
			if (i + 1 < event.getPointerCount())
				sb.append(";" );
		}
		
		sb.append("]" );
		
		setEventInfo(sb.toString());
		
		//Log.d(TAG, sb.toString());
    	
    	return true;
    }

    public void setEventInfo(String strData) {
    	EditText targetField  = (EditText) findViewById(R.id.textFieldForOnTouch);
    	targetField.setText(strData.toCharArray(), 0, strData.length());
    }

    /*
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.activity_main, menu);
        return true;
    }
    */
    
    /*

    public void sendMessage(View view) {
    	Intent intent = new Intent(this, DisplayMessageActivity.class);
    	EditText editText = (EditText) findViewById(R.id.edit_message);
    	String message = editText.getText().toString();
    	intent.putExtra(EXTRA_MESSAGE, message);
    	startActivity(intent);
    }
    */
}
